//
// Created by fengzijie on 14-5-28.
//
// 
//


#import <Foundation/Foundation.h>

@protocol AccountManagerDelegate <NSObject>

@optional

- (void)accountManagerUserLogout;

@end


@protocol accountManagerApiDelegate <NSObject>

@optional

- (void)accountManagerApiInfoRequestWith:(void (^)(id response))successBlock failBlock:(void (^)(NSError *error))failBlock;

- (void)accountManagerApiStop;

@end

@class AccountModel;

#define ACCOUNT_DID_LOGIN_NOTIFICATION  @"ACCOUNT_DID_LOGIN_NOTIFICATION"
#define ACCOUNT_WILLDID_LOGOUT_NOTIFICATION  @"ACCOUNT_WILLDID_LOGOUT_NOTIFICATION"
#define ACCOUNT_DID_UPDATED_NOTIFICATION  @"ACCOUNT_DID_UPDATED_NOTIFICATION"
#define ACCOUNT_DID_LOGOUT_NOTIFICATION @"ACCOUNT_DID_LOGOUT_NOTIFICATION"

@interface AccountManager : NSObject

//未登录时，返回nil
@property(nonatomic,readonly) AccountModel *account;

@property(nonatomic,weak) id<AccountManagerDelegate> accountManagerDelegate;

//登陆成功时调用
- (void)loginWithSimpleAccount:(AccountModel *)account;
//登陆失效或者手动退出时调用
- (void)logout;

/**
* 刷新用户账号信息, 刷新完成后触发EDJ_ACCOUNT_DID_UPDATED_NOTIFICATION
*/
- (void)refreshAccountInfo;

//持久化账号信息
- (void)persistenceAccountInfo;

- (NSString *)pathOfCacheFile;

@end